import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementUI from 'element-ui'
import './permission'

// TODO: 目前图片太多，影响加载, 后期优化
import './assets/images/icons'

// 加载全局样式
import './styles/index.scss'

import { resetForm, selectDictLabel, handleTree } from '@/utils/sundry'
import { getDicts } from '@/services/system/dict/data'
import { getConfigKey } from '@/services/system/config'
import Pagination from '@/components/Pagination/index.vue'
import RightToolbar from '@/components/RightToolbar/index.vue'
import permission from './directive/permission'

// 加载全局挂载函数
Vue.prototype.getConfigKey = getConfigKey
Vue.prototype.getDicts = getDicts
Vue.prototype.resetForm = resetForm
Vue.prototype.selectDictLabel = selectDictLabel
Vue.prototype.handleTree = handleTree

// 全局挂载组件
Vue.component('Pagination', Pagination)
Vue.component('RightToolbar', RightToolbar)
Vue.use(ElementUI)

// 挂载全局指令
Vue.use(permission)

Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
